﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;

namespace PatNetShop.WebControls
{
    [DefaultProperty("Text")]
    [ToolboxData("<{0}:ThemesDropDownList runat=server></{0}:ThemesDropDownList>")]
    public class ThemesDropDownList : DropDownList
    {
        public ThemesDropDownList()
        {
            String[] directories = Directory.GetDirectories(HttpContext.Current.Server.MapPath("~/Themes"));
            foreach (string path in directories)
            {
                string themes = path.Substring(path.LastIndexOf('\\') + 1);
                Items.Add(new ListItem(themes, themes));
            }
        }
    }
}
